﻿<div ms-controller="WTFKLIST">
    <div class="btn-add">
        <button type="button" class="btn btn-info btn-lg" ms-click="AddView('WTFK')"><i class="iconfont icon-jiahao ft12 mr5"></i>添加问题反馈</button>
    </div>
    <!-- 按条件选择 -->
    <div class="tab-filter-type">
        <!-- 搜索 -->
        <div class="oh">
            <div class="input-group ml15" style="width:295px;">
                <input type="search" class="form-control" placeholder="搜索反馈内容" ms-duplex="search.searchcontent">
                <span class="input-group-addon" ms-click="GetLIST()">搜索</span>
            </div>
        </div>
        <!-- 展开更多选项 -->
        <div class="add-tab ft14 tc mt20" style="display: none;">
            <span>更多筛选<i class="caret"></i></span>
        </div>
    </div>
    <!--分割线-->
    <div class="add-tab ft14 tc mt20">
    </div>
    <!--工作报告-->
    <div class="activity ft14">
        <div class="activity-list pt20 pb20 " ms-repeat-el="tmpListData" ms-click="ViewForm('WTFK_WTFK',el.ID,'',$event)">
            <div class="head-img pull-left">
                <img ms-attr-src="/ViewV5/Base/DownFile.aspx?type=TX&user={{el.CRUser}}" onerror="javascript: this.src = 'images/head.jpg'" style="cursor:pointer;">
                <p class="tc c999 ft12 mt5">{{ComFunJS.convertuser(el.CRUser)}}</p>
            </div>
            <div class="activity-cont">
                <!--<p>部门：{{el.BranchName}}</p>-->
                <p>时间：{{el.CRDate|date("yyyy-MM-dd")}}</p>
                <p>反馈内容：{{FnFormat(el.FKContent,{"format": "text"})|html}}<span ms-if="el.Files"><i class="iconfont icon-fj ft14 ml5"></i></span></p>
            </div>
            <div class="btn-add">
                <a class="cz-btn ft18 bj-color tip" data-toggle="tooltip" title="编辑" ms-if="el.CRUser==userName" ms-click="EditForm('WTFK',el.ID,'',$event)">
                    <i class="iconfont icon-bianji"></i>
                </a>
                <a class="cz-btn ft18 sc-color tip" data-toggle="tooltip" title="删除" ms-if="el.CRUser==userName" ms-click="DELWTFK(el,$event)">
                    <i class="iconfont icon-shanchu"></i>
                </a>
            </div>
        </div>
        <div class="pt20 ft14" ms-if="isnull">
            <p>暂无数据</p>
        </div>
        <div class="ui-datatable-page ft14 pl20">

            <div id="pageDiv" ms-visible="model.page.total>model.pageNum[0].num" class="pull-right"></div>
            <div class="pull-right" ms-visible="tmpListData.size()!=0">
                <span>共{{model.page.total}}条记录</span>
                <span ms-visible="model.page.total>model.pageNum[0].num">
                    选择每页条数
                    <select style="height: 25px; width: 50px;" ms-change="selNum(this.value)" ms-duplex="model.page.pagecount">
                        <option ms-repeat-pg="pageNum" ms-attr-value="pg.num" ms-attr-selected="pg.num==model.page.pagecount?'selected':''">{{pg.num}}</option>
                    </select>
                </span>
            </div>

        </div>
    </div>
</div>
<script>
    $(function () {
        $('[data-toggle="tooltip"]').tooltip()
    })
    var tempindex = avalon.define({
        $id: "WTFKLIST",
        tmpListData: [],
        SelectType: function (type) {
            model.search.seartype = type;
            tempindex.GetLIST();
        },
        selNum: function (item) {    //选择显示的条数
            model.page.pagecount = item;
            tempindex.GetLIST();
        },
        InitWigetData: function () {
            tempindex.GetLIST();
            ComFunJS.initForm();
        },

        GetLIST: function () {
            model.page.pageindex = 1;
            tempindex.tmpListData.clear();
            $.getJSON('/API/VIEWAPI.ashx?Action=WTFK_GETWTFKLIST', { p: 1, P2: model.search.searchcontent, pagecount: model.page.pagecount }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        tempindex.tmpListData = resultData.Result;
                        if (tempindex.tmpListData.size() == 0) { model.isnull = true; } else { model.isnull = false; }
                        model.page.total = resultData.Result1;
                        laypage({
                            cont: 'pageDiv', //容器。值支持id名、原生dom对象，jquery对象。
                            pages: Math.ceil(parseInt(resultData.Result1) * 1.0 / model.page.pagecount), //
                            curr: 1, //初始化当前页
                            skin: 'molv',
                            jump: function (e) { //触发分页后的回调
                                if (e.curr != model.page.pageindex) {
                                    $.getJSON('/API/VIEWAPI.ashx?Action=WTFK_GETWTFKLIST', { p: e.curr, P2: model.search.searchcontent, pagecount: model.page.pagecount }, function (resultData) {
                                        if (resultData.ErrorMsg == "") {
                                            tempindex.tmpListData = resultData.Result;
                                        }
                                    })
                                    model.page.pageindex = e.curr;
                                }
                            }
                        });
                    }
                })
        },
        dcgzbg: function () {
            if (model.page.total > 0) {
                $(this).attr("href", "/API/VIEWAPI.ashx?Action=GZBG_EXPORTGZBG&type=" + model.search.seartype + "&P2=" + model.search.searchcontent + "&pagecount=" + model.page.total + "&P1=" + tempindex.curXJType + "&time=" + tempindex.curXJTime + "&starTime=" + tempindex.starTime + "&endTime=" + tempindex.endTime);
            }
            else {
                top.ComFunJS.winwarning("无数据");
            }
        },
        DELWTFK: function (item, event) {
            if (event) {
                event.stopPropagation();
            }
            top.ComFunJS.winconfirm("确认要删除吗", function () {
                $.post('/API/VIEWAPI.ashx?Action=WTFK_DELWTFKBYID', { "P1": item.ID }, function (result) {
                    result = JSON.parse(result)
                    if (result.ErrorMsg == "") {
                        top.ComFunJS.winsuccess("删除成功");
                        tempindex.tmpListData.remove(item);
                    } else {
                        top.ComFunJS.winwarning(result.ErrorMsg);
                    }
                })
            }, function () { })
        }
    })
    //@ sourceURL=WTFKLIST.js;
</script>


